import { reactive } from "vue";

export const rules = reactive({
  user_name: [
    {
      required: true,
      message: "请输入账号",
      trigger: "onChange",
    },
    { pattern: /^[A-Za-z0-9]+$/, message: "只能输入字母和数字" },
  ],
  password: [
    {
      required: true,
      message: "请输入密码",
      trigger: "onChange",
    },
    { pattern: /^[A-Za-z0-9]+$/, message: "只能输入字母和数字" },
  ],
  true_name: [
    {
      required: true,
      message: "请输入姓名",
      trigger: "onBlur",
    },
    { pattern: /^[\一-\龥]{2,6}$/, message: "请输入正确的姓名" },
  ],
  type: [
    {
      required: true,
      message: "请阅读注册协议并勾选同意",
    },
  ],
  phone: [
    {
      name: "phone",
      required: true,
      message: "请输入手机号码",
    },
    {
      pattern: /^1\d{10}$/,
      message: "请输入正确的手机号码",
      trigger: "onChange",
    },
  ],
  sms_code: [
    {
      required: true,
      message: "请输入短信验证码",
    },
  ],
});

export default rules;
